home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / CW GUSI 1.6.4 / include / compat.h next >
Text File  |  1995-06-24  |  4KB  |  122 lines

  1. /*-
  2.  * Copyright (c) 1991, 1993
  3.  *    The Regents of the University of California.  All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  * 1. Redistributions of source code must retain the above copyright
  9.  *    notice, this list of conditions and the following disclaimer.
  10.  * 2. Redistributions in binary form must reproduce the above copyright
  11.  *    notice, this list of conditions and the following disclaimer in the
  12.  *    documentation and/or other materials provided with the distribution.
  13.  * 3. All advertising materials mentioning features or use of this software
  14.  *    must display the following acknowledgement:
  15.  *    This product includes software developed by the University of
  16.  *    California, Berkeley and its contributors.
  17.  * 4. Neither the name of the University nor the names of its contributors
  18.  *    may be used to endorse or promote products derived from this software
  19.  *    without specific prior written permission.
  20.  *
  21.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  22.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  25.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  27.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31.  * SUCH DAMAGE.
  32.  *
  33.  *    @(#)compat.h    8.1 (Berkeley) 6/2/93
  34.  */
  35.  
  36. #ifndef    _COMPAT_H_
  37. #define    _COMPAT_H_
  38.  
  39. #ifndef macintosh
  40. #ifdef __MWERKS__
  41. #define macintosh 1
  42. #endif
  43. #endif
  44.  
  45. /*
  46.  * If your system doesn't specify a max size for a SIZE_T, check
  47.  * to make sure this is the right one.
  48.  */
  49. #ifndef SIZE_T_MAX
  50. #define    SIZE_T_MAX    UINT_MAX
  51. #endif
  52.  
  53. /*
  54.  * If you don't have POSIX 1003.1 signals, the signal code surrounding the 
  55.  * temporary file creation is intended to block all of the possible signals
  56.  * long enough to create the file and unlink it.  All of this stuff is
  57.  * intended to use old-style BSD calls to fake POSIX 1003.1 calls.
  58.  */
  59. #ifdef NO_POSIX_SIGNALS
  60. #define sigemptyset(set)    (*(set) = 0)
  61. #define sigfillset(set)        (*(set) = ~(sigset_t)0, 0)
  62. #define sigaddset(set,signo)    (*(set) |= sigmask(signo), 0)
  63. #define sigdelset(set,signo)    (*(set) &= ~sigmask(signo), 0)
  64. #define sigismember(set,signo)    ((*(set) & sigmask(signo)) != 0)
  65.  
  66. #define SIG_BLOCK    1
  67. #define SIG_UNBLOCK    2
  68. #define SIG_SETMASK    3
  69.  
  70. extern int __sigtemp;        /* For the use of sigprocmask */
  71.  
  72. /* Repeated test of oset != NULL is to avoid "*0". */
  73. #define    sigprocmask(how, set, oset)                    \
  74.     ((__sigtemp =                            \
  75.     (((how) == SIG_BLOCK) ?                        \
  76.         sigblock(0) | *(set) :                    \
  77.     (((how) == SIG_UNBLOCK) ?                    \
  78.         sigblock(0) & ~(*(set)) :                \
  79.     ((how) == SIG_SETMASK ?                        \
  80.         *(set) : sigblock(0))))),                \
  81.     ((oset) ? (*(oset ? oset : set) = sigsetmask(__sigtemp)) :    \
  82.         sigsetmask(__sigtemp)), 0)
  83. #endif
  84.  
  85. #if defined(SYSV) || defined(SYSTEM5) || defined(macintosh)
  86. #define    index(a, b)            strchr(a, b)
  87. #define    rindex(a, b)        strrchr(a, b)
  88. #define    bzero(a, b)            memset(a, 0, b)
  89. #define    bcmp(a, b, n)        memcmp(a, b, n)
  90. #define    bcopy(a, b, n)        memmove(b, a, n)
  91. #endif
  92.  
  93. /* POSIX 1003.2 RE limit. */
  94. #ifndef    _POSIX2_RE_DUP_MAX
  95. #define    _POSIX2_RE_DUP_MAX    255
  96. #endif
  97.  
  98. #ifndef    WCOREDUMP            /* 4.4BSD extension */
  99. #define    WCOREDUMP(a)    0
  100. #endif
  101.  
  102. #ifndef _POSIX2_RE_DUP_MAX
  103. #define    _POSIX2_RE_DUP_MAX    255
  104. #endif
  105.  
  106. #ifndef NULL                /* ANSI C #defines NULL everywhere. */
  107. #define    NULL        0
  108. #endif
  109.  
  110. #ifndef    MAX
  111. #define    MAX(_a,_b)    ((_a)<(_b)?(_b):(_a))
  112. #endif
  113. #ifndef    MIN
  114. #define    MIN(_a,_b)    ((_a)<(_b)?(_a):(_b))
  115. #endif
  116.  
  117. #ifndef _BSD_VA_LIST_
  118. #define    _BSD_VA_LIST_    char *
  119. #endif
  120.  
  121. #endif /* !_COMPAT_H_ */
  122.